#pragma once

namespace ECS
{
	template<typename TSingle>
	class Singleton
	{
	public:
		static TSingle* instance()
		{
			if(_stpSingleType == nullptr)
			{
				_stpSingleType = new TSingle();
			}

			return _stpSingleType;
		}

	protected:
		Singleton() {}
		~Singleton() {}
		static TSingle * _stpSingleType;
	};

	template<typename TSingle>
	TSingle* Singleton<TSingle>::_stpSingleType = nullptr;
}